<template>
    <div class="sys_bug_work_sheet_detail_container">
        <vxeTableTemplate :data="dataList" :options.sync="tableOptions" />
    </div>
</template>

<script>
export default {
    name: "BugWorkSheetDetailForm",
    props: {
        propsData: {
            type: Object,
            default() {
                return {
                    init: true,
                };
            },
        },
    },
    data() {
        let _this = this;
        return {
            searchForm: {},
            dataList: [],
            selectionList: [],
            tableOptions: {
                ref: "SysBugWorkSheetDetailTable",
                container: ".sys_bug_work_sheet_detail_container",
                multiSelect: false,
                getMaxHeight() {
                    return '550px';
                },
                columns: [
                    {
                        label: "创建日期",
                        prop: "create_date",
                        align: "center",
                        minWidth: 120,
                    },
                    {
                        label: "数据类型",
                        prop: "data_type",
                        align: "center",
                        minWidth: 80,
                        formatter: (row) => {
                            if (_this.$utils.isNotEmpty(row.data_type) && row.data_type === '1') {
                                return '使用者';
                            } else if (_this.$utils.isNotEmpty(row.data_type) && row.data_type === '2') {
                                return '平台';
                            }
                            return '';
                        },
                    },
                    {
                        label: "账套名称",
                        prop: "account_name",
                        align: "center",
                        minWidth: 100,
                    },
                    {
                        label: "问题详情",
                        prop: "bug_info",
                        align: "center",
                        minWidth: 190,
                    },
                    {
                        label: "处理详情",
                        prop: "deal_info",
                        align: "center",
                        minWidth: 190,
                    },
                ],
                operates: {
                    list: [
                        {
                            id: "detail",
                            icon: "fa fa-info-circle",
                            show: true,
                            type: "warning",
                            tooltip: {
                                content: "详情",
                            },
                            // permission: "",
                            method: (key, row, index) => {
                                _this.propsData.detail(row);
                            },
                        },
                    ]
                },
                pagination: false,
            },
        }
    },
    watch: {
        propsData: {
            handler() {
                this.init();
            },
            deep: true,
            immediate: true,
        },
    },
    mounted() {

    },
    methods: {
        // 初始化
        init() {
            const _this = this;
            if (_this.propsData.row && _this.propsData.row.sid) {
                _this.searchForm = {parent_sid: _this.propsData.row.sid};
                _this.getList();
            }
        },
        //
        getList() {
            const _this = this;
            _this.fetchData(_this.$api.API_FindSysBugWorksheetsByParentSid, _this.searchForm).then(result => {
                _this.dataList = result.data || [];
            }).catch(() => {
            });
        },
    },
}
</script>

<style scoped>

</style>
